package org.ksug.samples.springmvc;

import java.util.HashMap;
import java.util.Map;

public class StaticMapAccountRepository implements AccountRepository {

	static Map<String, Account> accounts = new HashMap<String, Account>();

	static {
		accounts.put("1", new Account("1", "younghoe", "KSUG"));
		accounts.put("2", new Account("2", "toby", "KSUG"));
		accounts.put("3", new Account("3", "fromm", "KSUG"));
	}

	@Override
	public Account findAccount(String number) {
		return accounts.get(number);
	}

	@Override
	public void add(Account account) {
		accounts.put(account.getNumber(), account);
	}

}
